paned: Restrict picking to allocation
authorTimm Bäder <mail@baedert.org>
Wed, 6 Dec 2017 07:23:03 +0000 (08:23 +0100)
committerTimm Bäder <mail@baedert.org>
Wed, 6 Dec 2017 07:23:03 +0000 (08:23 +0100)
Same reason as GtkViewport does it: We might allocate child widgets
outside of the paned's content allocation. For drawing, we add a clip
node.

This was causing the "Record" button in the inspector recorder to ignore
pointer events since the treeview column header label in the GtkPaned
was swallowing it.

gtk/gtkpaned.c

index 329b9d5692a46a31b1c89e79f0fdf3205cd48415..04d8829b7f326da411bb4ff68539382dd86c2112 100644 (file)
@@ -332,6 +332,25 @@ gtk_paned_motion_notify (GtkWidget      *widget,
   return GTK_WIDGET_CLASS (gtk_paned_parent_class)->motion_notify_event (widget, event);
 }
 
+static GtkWidget *
+gtk_paned_pick (GtkWidget *widget,
+                   double     x,
+                   double     y)
+{
+  if (x >= 0 && x <= gtk_widget_get_width (widget) &&
+      y >= 0 && y <= gtk_widget_get_height(widget))
+    {
+      return GTK_WIDGET_CLASS (gtk_paned_parent_class)->pick (widget, x, y);
+    }
+  else
+    {
+      if (gtk_widget_contains (widget, x, y))
+        return widget;
+      else
+        return NULL;
+    }
+}
+
 static void
 gtk_paned_class_init (GtkPanedClass *class)
 {
@@ -357,6 +376,7 @@ gtk_paned_class_init (GtkPanedClass *class)
   widget_class->focus = gtk_paned_focus;
   widget_class->motion_notify_event = gtk_paned_motion_notify;
   widget_class->direction_changed = gtk_paned_direction_changed;
+  widget_class->pick = gtk_paned_pick;
 
   container_class->add = gtk_paned_add;
   container_class->remove = gtk_paned_remove;